home *** CD-ROM | disk | FTP | other *** search
- PAGE 55,130
- ; RMEXT
- ;
-
- codeseg segment
- assume cs:codeseg, ds:codeseg
-
- org 100h
-
- rmext proc far
-
- start: jmp Main
-
- Main: call get_line
- jc Exit
- call fix_line
- call put_line
- jmp short Main
-
- Exit: int 020h
-
- rmext endp
-
- ; SUBROUTINE
- ; sends line to std output
-
- put_line proc near
- mov si,offset buffer
- mov dx,si
- xor cx,cx
- put_1:
- inc cx
- lodsb
- cmp al,0Ah
- jne put_1
- mov bx,1
- mov ah,40h
- int 21h
- jc put_line_ret
- or ax,ax
- stc
- jz put_line_ret
- clc
- put_line_ret: ret
- put_line endp
-
-
- ; SUBROUTINE
- ; inputs lines from std input
-
- get_line proc near
- mov si,offset buffer
- get_1: mov dx,si
- mov cx,1
- mov bx,0
- mov ah,3Fh
- int 21h
- jc get_line_ret
- cmp byte ptr [si],0Ah
- je get_line_ret
- cmp byte ptr [si],1Ah
- stc
- jz get_line_ret
- mov cx,ax
- jcxz get_line_ret
- inc si
- jmp short get_1
- get_line_ret: ret
- get_line endp
-
-
- ; SUBROUTINE
- ; This routine looks for the period and moves eoln up to it.
-
- fix_line proc near
- sub si,2
- fix_1: cmp byte ptr [si],2Eh
- je fix_2
- cmp byte ptr [si],5Ch
- je fix_line_ret
- cmp byte ptr [si],2Fh
- je fix_line_ret
- dec si
- cmp si,28Ah
- je fix_line_ret
- jmp short fix_1
- fix_2: mov byte ptr [si],0Dh
- mov byte ptr [si+1],0Ah
- fix_line_ret: ret
- fix_line endp
-
- buffer db 0
-
- codeseg ends
- end start
-